# Contributor: Ivan Tham <pickfire@riseup.net>
# Maintainer: prspkt <prspkt@protonmail.com>
pkgname=you-get
pkgver=0.4.1650
pkgrel=2
pkgdesc="Tiny command line utility to download media contents"
url="https://you-get.org"
arch="noarch"
license="MIT"
depends="ca-certificates ffmpeg python3"
makedepends="py3-setuptools"
subpackages="
	$pkgname-pyc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://files.pythonhosted.org/packages/source/y/you-get/you-get-$pkgver.tar.gz"
options="!check" # tests rely on external services

build() {
	python3 setup.py build
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages testenv
	testenv/bin/python3 setup.py install
	testenv/bin/python3 -m unittest discover
}

package() {
	python3 setup.py install --skip-build --root="$pkgdir"

	install -Dm644 contrib/completion/you-get-completion.bash \
		"$pkgdir"/usr/share/bash-completion/completions/you-get
	install -Dm644 contrib/completion/you-get.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/you-get.fish
	install -Dm644 contrib/completion/_you-get \
		"$pkgdir"/usr/share/zsh/site-functions/_you-get
}

sha512sums="
107ecadbd778c0b49729679ea8b4c68ff4c2d97b5bac1ae830fe2d7702cb47e85396f50ffb23dddd062bc2c67160ccb21d7040ea3c0cd9f977b5f845365f8ac0  you-get-0.4.1650.tar.gz
"
